global with sharing class buttonExecutionClass
{

	webservice static String quoteItemSortMethod(Id quoteId)
    {
        //pull back the OLIs in a specific sort order
        List<QuoteLineItem> quoteItemObjectList = null; 
        
        quoteItemObjectList = [Select Id,Item_Number__c,QuoteId From QuoteLineItem Where QuoteId = :quoteId ORDER BY Item_Number__c];
        
        //build the comma separated 15 character OLI Id string to send back
        String sortedIds = '';                    
        for(QuoteLineItem oli : quoteItemObjectList)
        {
            sortedIds += String.valueOf(oli.Id).substring(0,15) + ',';      
        }
        
        //remove the last comma
        sortedIds = sortedIds.substring(0,sortedIds.length() - 1);
        return sortedIds;
    }

	webservice static String oppItemSortMethod(Id oppId)
    {
        //pull back the OLIs in a specific sort order
        List<OpportunityLineItem> oppItemObjectList = null; 
        
        oppItemObjectList = [Select Id,Item_Number__c,OpportunityId From OpportunityLineItem Where OpportunityId = :oppId ORDER BY Item_Number__c];
        
        //build the comma separated 15 character OLI Id string to send back
        String sortedIds = '';                    
        for(OpportunityLineItem oli : oppItemObjectList)
        {
            sortedIds += String.valueOf(oli.Id).substring(0,15) + ',';      
        }
        
        //remove the last comma
        sortedIds = sortedIds.substring(0,sortedIds.length() - 1);
        return sortedIds;
    }



}